<template>
	<view class="content">
		<view class="lottery">
			<dengbo-lotteryWheel :prizes="prizes" :size="626" :duration="5000" @run="onWheelClick"
				@done="onWheelDone" ref="luckyWheel" :lightImgs="lightImages" customStyle="borderRadius: 50%;">
				<template v-slot:bg>
					<image src="/static/tzbj.png" style="width: 100%; height: 100%" />
				</template>
				<template v-slot:pointer>
					<image src="/static/tan.png" style="width: 212rpx" mode="widthFix" @click="startWheel"/>
				</template>
			</dengbo-lotteryWheel>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				lightImages: ['/static/tpoint1.png', '/static/tpoint2.png'],
				prizes: [{
						name: '积分',
						image: '/static/thb.png',
						pro: '50积分',
					},
					{
						name: '积分',
						image: '/static/thb.png',
						pro: '100积分',
					},
					{
						name: '优惠券',
						image: '/static/thb.png',
						pro: '15元优惠券',
					},
					{
						name: '家用电器',
						image: '/static/thb.png',
						pro: '微波炉',
					},
					{
						name: '谢谢参与',
						image: '/static/thb.png',
						pro: '15元优惠券',
					},
					{
						name: '办公用品',
						image: '/static/thb.png',
						pro: '机械键盘',
					},
					{
						name: '生活用品',
						image: '/static/thb.png',
						pro: '化妆刷',
					},
				],
			}
		},
		onLoad() {

		},
		methods: {
			startWheel() {
				this.$refs.luckyWheel.run(2);
			},
			onWheelClick() {
				console.log('用户点击了转盘');
				this.$refs.luckyWheel.run(2);
			},
			onWheelDone(prize) {
				console.log('抽奖结束，中奖奖品：', prize);
			},
		}
	}
</script>

<style>
	.content{
		display: flex;
		flex-direction: column;
		align-items: center;
	}
	.lottery {
	    position: relative;
	    display: inline-block;
	    width: 626rpx;
	    height: 626rpx;
		margin-top: 100rpx;
	  }
</style>